import 'package:boss/common/common.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/login/login_page.dart';
import 'package:boss/ui/page/splash/model/splash.dart';
import 'package:boss/ui/widget/button/radius_button.dart';
import 'package:boss/ui/widget/image/base_image.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flustars/flustars.dart' as flustars;
import 'package:flutter/material.dart';

class SplashItem extends StatelessWidget {
  final Splash data;
  final bool isLast;

  const SplashItem({
    Key key,
    this.data,
    this.isLast,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 155.h),
      child: Column(
        children: <Widget>[
          BaseImage(
            data.image,
            width: 644.h,
            height: 750.h,
          ),
          Container(
            margin: EdgeInsets.only(top: 40.h),
            child: Text(
              data.title,
              style: TextStyleConstant().blue_54,
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 10.h),
            child: Text(
              data.subtitle,
              style: TextStyleConstant().normal_4_32,
            ),
          ),
          if (isLast)
            Container(
              margin: EdgeInsets.only(top: 30.h),
              child: RadiusButton(
                title: '立即体验',
                width: 280.h,
                onTap: () {
                  flustars.SpUtil.putBool(Constant.spFirst, true);
                  Navigator.popAndPushNamed(context, LoginPage.pageName);
                },
              ),
            ),
        ],
      ),
    );
  }
}
